<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group([
    'namespace' => '\App\\Http\\Controllers\\dashboard',
    'middleware' => 'logaccess',
], function (\Illuminate\Routing\Router $router) {

    $router->group([
        'prefix' => 'auth',
    ], function () {
        Route::post('login', [\App\Http\Controllers\dashboard\AuthController::class, 'login']);
        Route::group([
            'middleware' => 'dash',
        ], function () {
            Route::post('logout', [\App\Http\Controllers\dashboard\AuthController::class, 'login']);
            Route::post('refresh', [\App\Http\Controllers\dashboard\AuthController::class, 'refresh']);
            Route::get('userinfo', [\App\Http\Controllers\dashboard\AuthController::class, 'userinfo']);
        });
    });

    $router->group([
        'prefix' => 'withdraw',
        'middleware' => 'dash',
    ], function () {
        Route::get('list', [\App\Http\Controllers\dashboard\WithdrawController::class, 'list']);
        Route::post('audit', [\App\Http\Controllers\dashboard\WithdrawController::class, 'audit']);
    });

});
